package com.bootdo.staticmask.dao;

import com.bootdo.staticmask.domain.MaskFileDO;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 
 * @author lkg
 * @email 1992lcg@163.com
 * @date 2018-05-02 15:50:17
 */
@Mapper
public interface MaskFileDao {

	MaskFileDO get(Integer fileId);
	
	List<MaskFileDO> list(Map<String,Object> map);
	
	int count(Map<String,Object> map);
	
	int save(MaskFileDO maskFile);
	
	int update(MaskFileDO maskFile);
	
	int remove(Integer file_id);
	
	int batchRemove(Integer[] fileIds);
	
	@Select("select file_name as name, file_id as id, createtime from mask_file where category_name = #{category}")
	List<Map<String, Object>> findNameAndIdAndCreatetime(@Param("category") String category);

	@Select("select `file_name`,`category_name`,`file_path`,`file_delimeter`,`file_encode`,`file_firstline` from mask_file where file_name = #{fileName}")
	MaskFileDO findOneByName(@Param("fileName") String fileName);
}
